package neuron.library.ga.selection;


import neuron.library.ga.AbstractGeneticMachine;
import neuron.library.ga.common.Population;

/*
 * This strategy kills all of the worst chromosomes.
 */
public class TruncationSelection extends SelectionStrategy {

	public TruncationSelection(AbstractGeneticMachine gm) {
		super(gm);
	}

	@Override
	public void selection(Population population) {
		population.sortPopulation();
		while (population.size() > gm.getConfig().getPopulatonSize()) {
			population.remove(population.size()-1);
		}
	}

}
